package com.example.lotterysystem.common.exception;

import com.example.lotterysystem.common.errorcode.ErrorCode;
import lombok.Data;
import lombok.EqualsAndHashCode;


@Data
@EqualsAndHashCode(callSuper = true)  //继承父类属性，将父类属性带进来
public class ServiceException extends RuntimeException {
    /**
     * 异常码
     * @see ErrorCode
     */


    private int code;
    /**
     * 异常消息
     */
    private String msg;

    public ServiceException(){

    }
    public ServiceException(ErrorCode errorCode){
        this.code=errorCode.getCode();
        this.msg=errorCode.getMsg();


    }

    public ServiceException(int code,String msg){
        this.code=code;
        this.msg=msg;

    }
}
